﻿/*
* Project WarRoom
* https://warroom.codeplex.com/
*
* Copyright 2012, Yi-Fan Liao
*
* This file is part of Project WarRoom.
*
* Project WarRoom is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
* 
* Project WarRoom is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with Project WarRoom.  If not, see <http://www.gnu.org/licenses/>.
*
* Date: Fri Aug 24 21:41:08 2012 +0800
*/

(function ($) {

    $(document).ready(function () {
        var warroom = $("#chatroom").chatroom({
            visible: false,

            getMessagesUrl: "WarRoom.aspx/GetMessages",
            getNewMessagesUrl: "WarRoom.aspx/GetNewMessages",
            submitMessageUrl: "WarRoom.aspx/SubmitMessage",
            getUserListUrl: "WarRoom.aspx/GetOnlineUsers",

            alertNewMessages: function (unreadMessageCount) {
                if (unreadMessageCount === 1) {
                    $.titleAlert(unreadMessageCount + " new message!");
                }
                else {
                    $.titleAlert(unreadMessageCount + " new messages!");
                }
            },

            stopAlert: function () {
                $.titleAlert.stop();
                document.title = "404 Not Found";
            }
        });
    });

}(jQuery));